package com.cupk.service.impl;

import com.cupk.mapper.BannerMapper;
import com.cupk.pojo.Banner;
import com.cupk.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public void addBanner(Banner banner) {
        bannerMapper.addBanner(banner);
    }

    @Override
    public List<Banner> getBannerList() {
        return bannerMapper.getBannerList();
    }

    @Override
    public List<Banner> getEffectiveList() {
        LocalDateTime now = LocalDateTime.now();
        return bannerMapper.getEffectiveList(now);
    }

    @Override
    public void updateBanner(Banner banner) {
        bannerMapper.updateBanner(banner);
    }

    @Override
    public void deleteBanner(Integer bannerId) {
        bannerMapper.deleteBanner(bannerId);
    }
}
